$(function() {
    $('#tables > div > ul > li > a[name="tableInfo"]').click(
      function() {
        var tbRow = $(this);
        var tableId = tbRow.attr('data-tableid');
        var url = 'SelectTable.action';
        // alert(url);
        $.getJSON(
            url, {tableId : tableId}, function(response) {
              // alert(response.tableId);
            }
        );
        var fromPage = $("fromPage").val();
        var urlBack = "";
        var sendData;
        if (fromPage == "foodInfo") {
          urlBack = "";
          sendData = default_reverse_transition_option;
        } else {
          urlBack = "";
          sendData = default_transition_option;
        }
        $.mobile.changePage(url, sendData);
      }
    );

    // table's link clicked -> table info
    $('#adminTables > div > ul > li > a[data-name="tableInfo"]').click(
      function() {
        var url = "GetTableInfo.action";
        var tableid = $(this).attr("data-tableid");
        var send_data = expand({data : {
                                         tableId:tableid,
                                         fromPage:"adminTables"
                                       }
                               },
            default_transition_option);
        $.mobile.changePage(url, send_data);
    });

});